package controls;

import javax.swing.JLabel;
import javax.swing.JTextField;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class LinkedField 
{
	private final static String FIELD_NAME="fieldName"; 
	private final static String LABEL="label"; 
	private final static String LENGHT="lenght"; 
	
	private String fieldName;
	private String label;
	private int length;	
	private JLabel jlabel;
	private JTextField textField;
	public LinkedField(Node item) 
	{
		this.fieldName = ((Element)item).getAttribute(FIELD_NAME);
		this.label = ((Element)item).getAttribute(LABEL);
		this.length = Integer.parseInt(((Element)item).getAttribute(LENGHT));
		jlabel = new JLabel(label);
		textField= new JTextField();
	}

	public JLabel getLabel() 
	{				
		return jlabel;
	}

	public JTextField getComponent() 
	{		
		return textField;
	}
	public String getText()
	{
		return textField.getText();
	}
	public void setText(String text)
	{
		textField.setText(text);
	}
	public String getFieldName()
	{
		return fieldName;
	}
	
}	
